import React, {Component} from 'react';
import {connect} from 'dva';

import {contant} from "./index.css";
import {Button} from 'antd';
import NavLink from "../../components/NavLink/NavLink";

class Orders extends Component {

  render() {

    const {dispatch, orders} = this.props;

    const {orderState} = orders;

    return (
      <div className={contant}>

        <div>
          <NavLink target='/home' linkText='首页'/>
        </div>

        <Button onClick={
          () => {
            dispatch({
              type: 'orders/getFinishOrder',
              payload: 'send',
            });
          }
        }>未完成订单</Button>
        <Button onClick={
          () => {
            dispatch({
              type: 'orders/ordering'
            });
          }}>进行中订单</Button>
        <Button>已完成订单</Button>

        <div>{`${orderState}`}</div>

      </div>
    );
  }
}

function mapStateToProps({orders}) {
  return {orders};
}

export default connect(mapStateToProps)(Orders);
